<template>
  <PageContainer>
    <view class="container">
      <Header title="领取福利券" />
      <TResult
        types="success"
        title="领取福利券成功"
        content="已成功领取福利券,快去查看吧!"
        cancel-text=""
        confirm-text="查看福利券"
        @cancel="cancel"
        @confirm="confirm"
      />
      <FixedCode />
    </view>
  </PageContainer>
</template>

<script lang="ts" setup>
  /* receiveCouponResult 领取优惠券 */
  import PageContainer from '@/components/PageContainer/index.vue';
  import Header from '@/components/Header/index.vue';
  import TResult from '@/components/TResult/index.vue';
  import FixedCode from '@/components/OfficialAccount/fixedCode.vue';
  import { onLoad, redirectTo } from '@/router';
  import { ref, unref } from 'vue';

  const id = ref<number>();
  const isShare = ref<boolean>(false);
  onLoad<'MemberCouponDetails'>((op) => {
    op.isShare && (isShare.value = op.isShare);
    id.value = op.id;
  });

  const cancel = () => {};

  const confirm = () => {
    redirectTo({
      name: 'memberCouponDetails',
      options: {
        id: unref(id) as number,
        isShare: unref(isShare),
      },
    });
  };
</script>

<style lang="scss" scoped></style>
